<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 时间轴</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="/Public/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/css/animate.css" rel="stylesheet">
    <link href="/Public/css/style.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="/Public/css/plugins/colorbox.css" />
    <link rel="stylesheet" type="text/css" href="/Public/admin/css/gxxj/normalize.css">
    <link rel="stylesheet" type="text/css" href="/Public/admin/css/gxxj/public_O.css">
    <link rel="stylesheet" type="text/css" href="/Public/admin/css/gxxj/workorder.css">
    <style>
        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: content-box;
        }s
        #popUpBox1 .popOrderBox{
            width: 600px;
            height: 500px;
        }
        #popUpBox1 .popOrderBox{
            width: 600px;
            height: 500px;
            top: 30%;
        }
    </style>
    <style>
        .timeline-item .date1 {
            text-align: right;
            width: 110px;
            position: relative;
            padding-top: 10px;
        }
        timeline-item .content1 {
            border-left: 1px solid #e7eaec;
            border-top: 1px solid #e7eaec;
            padding-top: 10px;
            min-height: 200px;
        }
        .project-people, .project-actions {
            text-align: inherit;
            vertical-align: middle;
        }
        .btn1 {
            display: inline-block;
            padding: 2px 6px;
            margin-bottom: 0;
            font-size: 14px;
            font-weight: 400;
            line-height: 0;
            text-align: center;
            white-space: nowrap;
            vertical-align: middle;
            -ms-touch-action: manipulation;
            touch-action: manipulation;
            cursor: pointer;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            background-image: none;
            border: 1px solid transparent;
            border-radius: 4px;
            margin-left: 10px;
        }
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row animated fadeInRight">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>
                        <div style="display: flex">
                        <div>工单详情 </div>
                        <a href="workorderlist.html?type=<{$type}>&page=<{$page}>&rid=<{$rid}>"  class="btn1 btn-white"  title="返回"><i class="fa fa-reply"></i> 返回</a>
                        </div>
                    </h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="timeline.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="timeline.html#">选项1</a>
                            </li>
                            <li><a href="timeline.html#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content timeline">
                    <div class="timeline-item">
                        <div class="row">
                            <div class="col-xs-7 date1">
                                <p>
                                    <switch name="data['status']">
                                        <case value="待处理">
                                            <a class="btn btn-danger btn-rounded" style=" border-radius: 0px;" href="javascript:;" >待处理</a>
                                        </case>
                                        <case value="已回复">
                                            <a class="btn btn-info btn-rounded" style=" border-radius: 0px;"  href="javascript:;" >已回复</a>
                                        </case>
                                        <case value="已完成">
                                            <a class="btn btn-success " style=" border-radius: 0px;"  href="javascript:;" >已完成</a>
                                        </case>
                                        <case value="已取消">
                                            <a class="btn btn-danger btn-rounded" style=" border-radius: 0px;" href="javascript:;" >已取消</a>
                                        </case>

                                    </switch></p>

                                <p class="m-b-xs"> 派发部门：</p>

                                <p>派发人：</p>
                                <p>接收部门：</p>
                                <p>受理人：</p>
                                <p>创建时间：</p>
                                <p>问题描述：</p>

                            </div>
                            <div class="col-xs-7 content ">
                                <p style="margin-top: 30px;"></p>
                                <p class="m-b-xs"><{$data.apart_id}></p>
                                <p><{$data.publish_name}></p>
                                <p><{$data.accept_apart_id}></p>
                                <p><{$data.accept_name}></p>
                                <p><{$data.ctime}></p>
                                <p class="project-people1" ><{$data.content}><br>
                                    <div style="display: flex">
                                    <volist name="imgs1" id="vo" empty=''>
                                        <div style="display: block;margin-bottom: 10px;" class="project-people">
                                        <a href="<{$vo}>" class="img_link"  data-rel="colorbox"> <img src="<{$vo}>" style="height: 150px;width: 150px"></a>
                                        </div>
                                    </volist>
                                    </div>
                                </p>
                                <p> 补充说明：<{$data.extra_content}></p>

                            </div>
                        </div>
                    </div>
                    <div class="timeline-item">
                        <div class="row">
                            <div class="col-xs-7 date1">
                              <!--  <p class="m-b-xs"> <strong>操作记录：</strong></p>-->
                            </div>
                            <div class="col-xs-7 content">
                            </div>
                        </div>
                    </div>
                    <volist name="work_log" id="vo" empty=''>
                        <div class="timeline-item">
                            <div class="row">
                                <div class="col-xs-3 date">
                                    <switch name="vo.type">
                                        <case value="1">
                                            <a class="btn btn-info btn-rounded" style=" border-radius: 0px;" href="javascript:;" >回复</a>
                                        </case>
                                        <case value="2">
                                            <a class="btn btn-danger btn-rounded" style=" border-radius: 0px;" href="javascript:;" >转交</a>
                                        </case>
                                        <case value="3">
                                            <a class="btn btn-success btn-rounded" style=" border-radius: 0px;" href="javascript:;" >完结</a>
                                        </case>
                                        <case value="4">
                                            <a class="btn btn-danger btn-rounded" style=" border-radius: 0px;" href="javascript:;" >取消</a>
                                        </case>
                                    </switch>

                                </div>
                                <div class="col-xs-7 content">

                                    <switch name="vo.type">
                                        <case value="1">
                                        <p class="m-b-xs project-people1" style="padding-top: 10px">
                                            <{$vo.apart_name}><{$vo.name}>：<{$vo.content}>
                                            <br>
                                            <div style="display: flex">
                                            <volist name="vo['img']" id="vi" empty=''>
                                                <div style="display: block;margin-bottom: 10px;" class="project-people">
                                                    <if condition="$vi neq ''">
                                                        <a href="<{$vi}>" class="img_link"  data-rel="colorbox"><img src="<{$vi}>" style="height: 150px;width: 150px"></a>

                                                    </if>
                                                </div>
                                            </volist>
                                        </div>
                                         </p>
                                         <p>
                                        <{$vo.ctime}>
                                         </p>
                                        </case>
                                        <case value="2">
                                            <p class="m-b-xs project-people1" style="padding-top: 10px">
                                                <{$vo.apart_name}><{$vo.name}>：转交工单
                                            </p>
                                            <p>
                                                <{$vo.ctime}>
                                            </p>

                                        </case>
                                        <case value="3">
                                            <p class="m-b-xs project-people1" style="padding-top: 10px">
                                                <{$data.apart_id}><{$data.publish_name}>：完结了工单
                                            </p>
                                            <p>
                                                <{$vo.upd_time}>
                                            </p>

                                        </case>
                                        <case value="4">
                                            <p class="m-b-xs project-people1" style="padding-top: 10px">
                                                <{$data.apart_id}><{$data.publish_name}>：关闭了工单
                                            </p>
                                            <p>
                                                <{$vo.upd_time}>
                                            </p>
                                        </case>
                                    </switch>



                                </div>
                            </div>
                        </div>
                    </volist>
                        <div class="timeline-item" id="cz">
                            <div class="row">
                                <div class="col-xs-3 date">
                                    <p><strong>操作</strong></p>
                                </div>
                                <div class="col-xs-7 content">
                                    <div class="m-b-xs" style="padding-top: 20px">
                                    <div class="details_formBox" id="feed_back">
                                        <form method="post" onsubmit="return false">
                                            <ul>
                                                <li>
                                                 <textarea name="feedback" id="feedback" class="areabox width_type2"  placeholder="请描述您的跟单结果"></textarea>
                                                </li>
                                                  <li>
                                                    <div class="details_submitBox">
                                                        <label class="details_fileBox fl"><input type="file" name="uploadimg" id="uploadimg"
                                                                                                 onchange="upload()">上传附件</label>
                                                        <input type="submit" class="details_submit fr" onclick="feedback_sub()" value="回复">
                                                        <div class="clear"></div>

                                                        <div>
                                                            <input id="title_img" type="hidden" name="title_img">
                                                            <!--<span class="help-block m-b-none">请上传图片大小为400*400px</span>-->

                                                            <div class="product_img" id="img">
                                                                <img src="/Public/admin/img/webuploader.png" style="height:100px;width: 100px">
                                                            </div>
                                                        </div>
                                                    </div>
                                                </li>
                                            </ul>
                                        </form>
                                        <br>
                                        <div  id="turn_to">
                                            <a href="javascript:;" id="extra" class="btn btn-info "  onclick="showPop1()">编辑补充说明</a>
                                            <a href="javascript:;" id="close" class="btn btn-primary "  onclick="showSureBox1()">取消工单</a>
                                            <a href="javascript:;" class="btn btn-success "  onclick="showPop2()">转交工单</a>
                                            <a href="javascript:;" id="end" class="btn btn-danger "  onclick="showSureBox2()">完结工单</a>
                                        </div>
                                     </div>

                                    </div>
                                </div>
                            </div>
                        </div>

                </div>
            </div>
        </div>
    </div>
    <div id="popUpBox1" class="popUpBox">
        <div class="popContBox popOrderBox">
            <h1>编辑补充说明</h1>
            <div class="pwdformBox orderformBox">
                <form id="extraCont" onsubmit="return false">
                    <ul>
                        <li>
                            <!--<label for="">编辑补充说明：</label>-->
                            <textarea style="width: 80%;height: 310px;" name="extra_content" id="extra_content"
                                      placeholder="请输入补充说明"> <{$data.extra_content}></textarea>
                        </li>
                    </ul>
                    <input type="submit" class="submit_editPwd" onclick="extra()" value="确 认">
                </form>
            </div>
        </div>
    </div>
    <!-- 转交工单 ********************* -->
    <div id="popUpBox2" class="popUpBox">
        <div class="popContBox popOrderBox">
            <h1>转交工单</h1>
            <div class="pwdformBox orderformBox">
                <form id="popCont" onsubmit="return false">
                    <ul>
                        <li>
                            <label for="">选择部门：</label>

                            <select name="apart_id" id="apart_id" class="selectBox">
                                <volist name="apart" id="vo">
                                    <option value=" <{$vo.id}>"> <{$vo.name}></option>
                                </volist>
                            </select>
                        </li>
                    </ul>
                    <input type="submit" class="submit_editPwd" onclick="turn_to()" value="确 认">
                </form>
            </div>
        </div>
    </div>

    <!-- 关闭工单 ****************************** -->
    <div id="surePopBox1" class="surePopBox">
        <div class="sureBox">
            <form action="">
                <div class="sureBoxCont">确认是否关闭工单</div>
                <div class="sureBox_btn">
                    <a href="javascript:;" class="Bgcolor_gray" onclick="cancel_Sure()">否</a><a onclick="close1()"
                                                                                                href="javascript:;"
                                                                                                class="bg_color_red2"
                                                                                                class="">是</a>
                </div>
            </form>
        </div>
    </div>
    <!-- 确认完结工单 ****************************** -->
    <div id="surePopBox2" class="surePopBox">
        <div class="sureBox">
            <form action="">
                <div class="sureBoxCont">是否确认完结此单</div>
                <div class="sureBox_btn">
                    <a href="javascript:;" class="Bgcolor_gray" onclick="cancel_Sure()">否</a><a onclick="finish()"
                                                                                                href="javascript:;"
                                                                                                class="bg_color_red2"
                                                                                                class="">是</a>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="/Public/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/js/content.js?v=1.0.0"></script>
<script type="text/javascript" src="/Public/admin/js/common.js"></script>
<script src="/Public/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/Public/admin/js/layer/layer.js"></script>
<script src="/Public/admin/js/plugins/layer/layer.min.js"></script>
<script src="/Public/admin/js/layui/layui.js"></script>
<script src="/Public/admin/js/ajaxfileupload.js"></script>
<script src="/Public/admin/js/plugins/jquery.colorbox-min.js"></script>
<script>
    jQuery(function ($) {
        colorbox_params = {
            reposition: true,
            scalePhotos: true,
            scrolling: false,
            previous: '<i class="fa fa-chevron-left"></i>',
            next: '<i class="fa fa-chevron-right"></i>',
            close: '&times;',
            current: '{current} of {total}',
            maxWidth: '100%',
            maxHeight: '100%',
            onOpen: function () {
                document.body.style.overflow = 'hidden';
            },
            onClosed: function () {
                document.body.style.overflow = 'auto';
            },
            onComplete: function () {
                $.colorbox.resize();
            }
        };
        $('.Info_style [data-rel="colorbox"]').colorbox(colorbox_params);
        $('.project-people [data-rel="colorbox"]').colorbox(colorbox_params);
        $("#cboxLoadingGraphic").append("<i class='icon-spinner orange'></i>");

    });

    function showPop1(){
        if($("#popUpBox1").is(":hidden")){
            $('#extraCont')[0].reset(); //閲嶇疆form琛ㄥ崟
            $("#popUpBox1").slideDown(500);
        }else{
            $("#popUpBox1").slideUp(500)
        }
    }
    function showSureBox1(){
        if($(".popUpBox").is(":hidden")){
            $("#surePopBox1").slideDown(500)
        }else{
            $("#surePopBox1").slideUp(500)
        }
    }
    function showPop2(){
        if($("#popUpBox2").is(":hidden")){
            $('#popCont')[0].reset(); //閲嶇疆form琛ㄥ崟
            $("#popUpBox2").slideDown(500)
        }else{
            $("#popUpBox2").slideUp(500)
        }
    }
    function showSureBox2(){
        if($(".popUpBox").is(":hidden")){
            $("#surePopBox2").slideDown(500)
        }else{
            $("#surePopBox2").slideUp(500)
        }
    }
    //    ==================================
    $(function () {
        var type = "<{$type}>";
        var status = "<{$status}>";

        var apart='<{$apart_id}>';
        var apart_name='<{$data.publish_name}>';
        var name='<{$name}>';

        var accept_apart_id='<{$accept_apart_id}>';

        if(apart==1){
            if(apart_name!=name ){
                $("#extra").hide();//补充说明
                $("#close").hide();//取消工单
                $("#end").hide();//完结工单
            }
            if('<{$data.accept_name}>'!=name){

            }
        }else {
            if(accept_apart_id==1){
                if('<{$data.accept_name}>'!=name){
                    $("#turn_to").hide();
                }else {
                    $("#extra").hide();//补充说明
                    $("#close").hide();//取消工单
                    $("#end").hide();//完结工单
                }
            }else {
                $("#cz").hide();
            }
            /*if (type == '1') {
                if(status==4||status==5){
                    $("#turn_to").hide();
                    $("#feed_back").hide();//全部
                }

            } else if (type == '2') {//我受理中
                $("#extra").hide();//补充说明
                $("#close").hide();//取消工单
            } else if (type == '3') {//我提交的
                if (status == '3' ||status==4) {
                    $("#turn_to").hide();
                    $("#feed_back").hide();//全部
                }
            } else if (type == '4') {
                $("#turn_to").hide();
                $("#feed_back").hide();//我完成
            } else if (type == '5') {//组内
                $("#turn_to").hide();
            }*/
        }

        if (type == '5') {//组内
            $("#turn_to").hide();
        }
        if(status==0 ||status==4 ||status==3){
            $("#cz").hide();
        }
    });
    //加载loading层
    var index = layer.load(1, {
        shade: [0.1, '#fff'] //0.1透明度的白色背景
    });
    var id = "<{$id}>";//详情ID
    function finish() {
        var url = "<{$SRVER_NAME}>/admin.php/WorkOrder/workorder_finish";
        $.post(url, {id: id}, function (data) {
            if (data.code == "1001") {
                var test = layer.alert(data.result, {title: '提示框', icon: 1}, function (index) {
                        window.location.reload();
                        layer.close(index);
                    }
                );
            }
            else {
                layer.alert(data.result, {title: '提示框', icon: 1});
                layer.close(index);
            }
        });
        layer.close(index);
    }
    //转交工单
    function turn_to() {
        var id = "<{$id}>";
        console.log(id);
        var apart = $("#apart_id").val();
        var url = "<{$SRVER_NAME}>/admin.php/WorkOrder/workorder_turn";
        var test = layer.alert("确认转交", {title: '提示框', icon: 0}, function (index) {

                $.post(url, {work_id: id, apart: apart}, function (data) {
                    if (data.code == "1001") {
                        var test = layer.alert(data.result, {title: '提示框', icon: 1}, function (index) {
                                window.location.reload();
                                layer.close(index);
                            }
                        );
                    }
                    else {
                        layer.alert(data.result, {title: '提示框', icon: 1});
                        layer.close(index);
                    }
                });
                layer.close(index);
            }
        );
    }


    var urllist = "";//图片链接
    function feedback_sub() {//提交回复
        var content = $("#feedback").val();
        var url = "<{$SRVER_NAME}>/admin.php/WorkOrder/workorder_feedback";
        if (content == null || content == "") {
            layer.close(index);
            layer.alert("回复不能为空！\r\n", {
                title: '提示框',
                icon: 0,
            });
            return false;
        }
        $.post(url, {id: id, back_content: content, img: urllist}, function (data) {
            if (data.code == "1001") {
                var test = layer.alert(data.result, {title: '提示框', icon: 1}, function (index) {
                        window.location.reload();
                        layer.close(index);
                    }
                );
            } else {
                layer.alert(data.result, {title: '提示框', icon: 1});
                layer.close(index);
            }
        });
        layer.close(index);
    }



    //上传图片
    function upload() {
        var tourl = '<{$SRVER_NAME}>/admin.php/Knowledge/uploadimg';
        $.ajaxFileUpload({
            url: tourl,//需要链接到服务器地址
            secureuri: false,
            fileElementId: 'uploadimg',//文件选择框的id属性file的id
            dataType: 'json',
            success: function (data) {
                if (data.code == '1001') {
                    if (urllist != '') {
                        urllist = data.result + "," + urllist;
                    } else {
                        urllist = data.result;
                    }
                    var strs = urllist.split(","); //字符分割
                    $('#img').empty();
                    for (var i = 0; i < strs.length; i++) {
                        var html = '<img  style="width:150px" src="' + strs[i] + '" />';
                        $('#img').append(html);
                    }

                } else {
                    if (data.status == '0') {
                        layer.alert(data.info);
                    } else {
                        layer.alert(data.result);
                    }
                }
            }
        });
    }
    layer.close(index);

    function extra() {
        var extra_content = $("#extra_content").val();
        var url = "<{$SRVER_NAME}>/admin.php/WorkOrder/extra_content";
        if (extra_content == null || extra_content == "") {
            layer.close(index);
            layer.alert("补充说明不能为空！\r\n", {
                title: '提示框',
                icon: 0,
            });
            return false;
        }
        $.post(url, {id: id, extra_content: extra_content}, function (data) {
            if (data.code == "1001") {
                var test = layer.alert(data.result, {title: '提示框', icon: 1}, function (index) {
                        window.location.reload();
                        layer.close(index);
                    }
                );
            } else {
                layer.alert(data.result, {title: '提示框', icon: 1});
                layer.close(index);
            }
        });
        layer.close(index);
    }
    function close1() {
        var url = "<{$SRVER_NAME}>/admin.php/WorkOrder/close";
        $.post(url, {id: id}, function (data) {
            if (data.code == "1001") {
                var test = layer.alert(data.result, {title: '提示框', icon: 1}, function (index) {
                        window.location.reload();
                        layer.close(index);
                    }
                );
            } else {
                layer.alert(data.result, {title: '提示框', icon: 1});
                layer.close(index);
            }
        });
    }
</script>
</body>
</html>
